Skip to content

Add feature-flags Copilot skill#7693

Open
jonrohan wants to merge 3 commits intomainfrom
add-feature-flags-skill
Open

Add feature-flags Copilot skill#7693
jonrohan wants to merge 3 commits intomainfrom
add-feature-flags-skill

Conversation

@jonrohan
Copy link
Member

@jonrohan jonrohan commented Mar 23, 2026

Adds a Copilot skill (SKILL.md) that provides agents with context on how feature flags work in Primer React. When an agent is asked to implement, create, test, or debug a feature flag, this skill is automatically loaded to provide the relevant architecture, patterns, and conventions.

The skill covers:

  • Feature flag architecture and file structure
  • How to add a new flag (DefaultFeatureFlags.tsuseFeatureFlag hook)
  • Naming conventions (primer_react_*, snake_case)
  • Common patterns (conditional behavior, component switching, data attributes)
  • Real codebase examples (Spinner, AnchoredOverlay, Breadcrumbs)
  • Testing with the FeatureFlags provider
  • Storybook integration (per-story and global)
  • Feature flag lifecycle (create → implement → ship → enable → remove)
  • Provider internals (FeatureFlagScope merging behavior)

Changelog

New

  • Added .github/skills/feature-flags/SKILL.md Copilot skill for feature flag guidance

Changed

Removed

Rollout strategy

  • None; this is a Copilot skill file that does not affect runtime code or the published package

Testing & Reviewing

This is a documentation-only change (a Copilot skill). To verify it works:

  1. Open VS Code with the Copilot extension
  2. Ask Copilot about feature flags (e.g., "How do I add a feature flag?")
  3. The skill should be automatically loaded and provide relevant guidance

Merge checklist

Adds a SKILL.md that provides agents with context on how feature flags
work in Primer React, including architecture, usage patterns, testing,
Storybook integration, and the feature flag lifecycle.
@changeset-bot
Copy link

changeset-bot bot commented Mar 23, 2026

⚠️ No Changeset found

Latest commit: c4fa13d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the staff Author is a staff member label Mar 23, 2026
@jonrohan jonrohan added skip changeset This change does not need a changelog integration-tests: skipped manually Changes in this PR do not require an integration test labels Mar 23, 2026
@jonrohan jonrohan marked this pull request as ready for review March 23, 2026 20:32
@jonrohan jonrohan requested a review from a team as a code owner March 23, 2026 20:32
@jonrohan jonrohan requested review from Copilot and hectahertz March 23, 2026 20:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Copilot “skill” document to provide consistent, repo-specific guidance for implementing and working with feature flags in @primer/react, including architecture, naming, testing, and Storybook workflows.

Changes:

  • Added a new skill file documenting Primer React feature flag architecture and usage patterns
  • Included examples for adding flags, using useFeatureFlag, testing via FeatureFlags, and Storybook usage
  • Documented feature-flag lifecycle and FeatureFlagScope merge behavior

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions bot temporarily deployed to storybook-preview-7693 March 23, 2026 20:41 Inactive
@primer
Copy link
Contributor

primer bot commented Mar 23, 2026

🤖 Formatting issues have been automatically fixed and committed to this PR.

Copy link
Member

@francinelucca francinelucca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Copy link
Contributor

@hectahertz hectahertz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, really useful to have the full lifecycle documented in one place.

Two small things worth considering:

  • The "Temporarily testing in Dotcom CI" tip (set flag to true in DefaultFeatureFlags.ts, set it back before merging) might be a bit risky as a skill instruction, since an agent could follow the first half literally and miss the rollback. Maybe worth either dropping it or adding a strong "do not merge with the flag set to true" warning.

  • The description frontmatter is pretty dense. Might be worth testing whether a shorter trigger description improves skill matching reliability, but not a big deal either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: skipped manually Changes in this PR do not require an integration test skip changeset This change does not need a changelog staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants